package org.springframework.boot;

import org.springframework.boot.context.properties.source.ConfigurationPropertySource;
import org.springframework.boot.context.properties.source.ConfigurationPropertySources;
import org.springframework.core.env.PropertySource;
import org.springframework.core.env.SimpleCommandLinePropertySource;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.support.ResourcePropertySource;

public class Step4 {
    public static void main1(String[] args) throws Exception{
        ApplicationEnvironment env = new ApplicationEnvironment();
        env.getPropertySources().addLast(new ResourcePropertySource(new ClassPathResource("application.properties")));
        //第四步
        ConfigurationPropertySources.attach(env);
        //第四步
        for (PropertySource<?> ps : env.getPropertySources()) {
            System.out.println(ps);
        }
        System.out.println(env.getProperty("zcj.first-name"));
        System.out.println(env.getProperty("zcj.middle-name"));
        System.out.println(env.getProperty("zcj.last-name"));
    }

}
